package nyangweb.shop.viewpager;


import android.content.Context;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.TextView;

public class SampleAdapter extends PagerAdapter {
	private Context mContext;
	public SampleAdapter(Context context) {
		mContext = context;
	}
	
	@Override
	public void destroyItem(View arg0, int arg1, Object arg2) {
		((ViewPager)arg0).removeView((View) arg2);
	}

	@Override
	public void finishUpdate(View arg0) {
	}

	@Override
	public int getCount() {
		return 10;
	}

	@Override
	public Object instantiateItem(View arg0, int arg1) {
		TextView child = new TextView(mContext);
		child.setText("Sample TextView" + arg1);
		((ViewPager)arg0).addView(child);
		return child;
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == ((View)arg1);
	}

	@Override
	public void restoreState(Parcelable arg0, ClassLoader arg1) {
		// TODO Auto-generated method stub

	}

	@Override
	public Parcelable saveState() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void startUpdate(View arg0) {
	}

}
